Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering of invalid spatial values #540

Merged
merged 5 commits into from
Oct 19, 2023
Merged

Filtering of invalid spatial values #540

merged 5 commits into from
Oct 19, 2023

Conversation

Amogh-Bharadwaj
Copy link
Contributor

  • Detects invalid spatial values such as single-point linestrings and open polygons, setting them as null on the pull side for QRep and CDC

@@ -13,6 +14,7 @@ import (
"github.com/jackc/pgx/v5/pgtype"
"github.com/lib/pq/oid"
log "github.com/sirupsen/logrus"
geom "github.com/twpayne/go-geos"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
could not import github.com/twpayne/go-geos (-: go build github.com/twpayne/go-geos:

@@ -124,6 +124,12 @@ func (g *GenericSQLQueryExecutor) CountRows(schemaName string, tableName string)
return count, err
}

func (g *GenericSQLQueryExecutor) CountNonNullRows(schemaName string, tableName string, columnName string) (int64, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
line is 123 characters (lll)

@@ -124,6 +124,12 @@
return count, err
}

func (g *GenericSQLQueryExecutor) CountNonNullRows(schemaName string, tableName string, columnName string) (int64, error) {
var count int64
err := g.db.QueryRowx("SELECT COUNT(CASE WHEN " + columnName + " IS NOT NULL THEN 1 END) AS non_null_count FROM " + schemaName + "." + tableName).Scan(&count)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
line is 162 characters (lll)

case qvalue.QValueKindGeography, qvalue.QValueKindGeometry, qvalue.QValueKindPoint:
flattenedCastsSQLArray = append(flattenedCastsSQLArray, fmt.Sprintf("CAST(%s:\"%s\" AS STRING) AS %s,",
case qvalue.QValueKindGeography:
flattenedCastsSQLArray = append(flattenedCastsSQLArray, fmt.Sprintf("TO_GEOGRAPHY(CAST(%s:\"%s\" AS STRING),true) AS %s,",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
line is 134 characters (lll)

flattenedCastsSQLArray = append(flattenedCastsSQLArray, fmt.Sprintf("TO_GEOGRAPHY(CAST(%s:\"%s\" AS STRING),true) AS %s,",
toVariantColumnName, columnName, targetColumnName))
case qvalue.QValueKindGeometry:
flattenedCastsSQLArray = append(flattenedCastsSQLArray, fmt.Sprintf("TO_GEOMETRY(CAST(%s:\"%s\" AS STRING),true) AS %s,",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
line is 133 characters (lll)

@iskakaushik iskakaushik merged commit 18b4094 into main Oct 19, 2023
12 checks passed
@serprex serprex deleted the allow-invalid-geo branch July 19, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants